package com.um.swing.common.util;

import javax.swing.*;
import java.awt.*;

/**
 * 创建人：袁泉
 * 创建时间：2022年04月26日00:03:30
 * 描述：Swing消息提示工具类
 */
public class MessageUtil {
    public static void alert(Component component, String msg) {
        alert(component,msg,JOptionPane.YES_OPTION);
    }

    public static void alert(Component component, String msg, int informationMessage) {
        JOptionPane.showMessageDialog(component, msg, "系统提示", informationMessage);
    }

    /**
     * 是否确认框
     *
     * @param o
     * @param s
     * @param yesNoCancelOption
     * @return
     */
    public static int confirm(Component component, String msg, int messageType) {
        return JOptionPane.showConfirmDialog(component, msg, "系统提示", messageType);
    }

    public static int confirm(Component component, String msg) {
        return confirm(component, msg, JOptionPane.YES_NO_OPTION);
    }


}
